﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.单例模式
{
    public class SingleObject
    {
        private readonly static SingleObject Instance = new ();
        private SingleObject() { }

        public static SingleObject GetInstance()
        {
            return Instance;
        }

#pragma warning disable CA1822 // 将成员标记为 static
        public void ShowMessage()
#pragma warning restore CA1822 // 将成员标记为 static
        {
            Console.WriteLine("Hello,I am a SingleObject.");
        }
    }
}
